package de.tum.in.eist.poll.shared;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Representation of an abstract user.
 */
public abstract class User implements IsSerializable {

	/**
	 * The user's unique name.
	 */
	private String name;

	/**
	 * The user's password.
	 */
	private String password;

	/**
	 * Default zero-argument constructor.
	 */
	public User() {
	}

	/**
	 * @param name
	 *            {@link #name}
	 * @param password
	 *            {@link #password}
	 */
	public User(String name, String password) {
		this.name = name;
		this.password = password;
	}

	/**
	 * @return the {@link #name}.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the {@link #password}.
	 */
	public String getPassword() {
		return password;
	}

	public boolean equals(Object other) {
		if(this == other) return true;
		if(other instanceof User) {
			return ((User)other).name.equals(name) && ((User)other).password.equals(password);
		}
		return false;
	}
}
